// Classe reponsável pelos botões do game
var Button = function(_x, _y, _w, _h, _c)
{
	this.position = {
		x: _x,
		y: _y
	}

	this.size = {
		width: _w,
		height: _h
	}

	this.color = _c;

	this.sprite = new Sprite(_x, _y, _w, _h, this.color);;

	this.update = function(evt)
	{
		// Verificando com qual botão do mouse foi clicado
		this.clickLeft(Collider.inside(mousePosition.x, mousePosition.y, 0, 0, this.position.x, this.position.y, this.size.width, this.size.height), mousePressed.LEFT, evt);
		this.clickMiddle(Collider.inside(mousePosition.x, mousePosition.y, 0, 0, this.position.x, this.position.y, this.size.width, this.size.height), mousePressed.MIDDLE, evt);
		this.clickRight(Collider.inside(mousePosition.x, mousePosition.y, 0, 0, this.position.x, this.position.y, this.size.width, this.size.height), mousePressed.RIGHT, evt);
	}

	this.draw = function()
	{
		this.sprite.draw();
	}

	/*============== Funções de click, cada uma representa um botão do mouse  ==============*/

	this.clickLeft = function(colliderInside, mousePressed, evt)
	{
		if(colliderInside && mousePressed){	evt(); }
	}

	this.clickMiddle = function(colliderInside, mousePressed, evt)
	{
		if(colliderInside && mousePressed){	evt(); }
	}

	this.clickRight = function(colliderInside, mousePressed, evt)
	{
		if(colliderInside && mousePressed){	evt(); }
	}
/*
	this isHover = function(btn)
	{
		canvas.style.cursor = Collider.inside(mousePosition.x, mousePosition.y, 0, 0, btn.position.x, btn.position.y, btn.size.width, btn.size.height) ? "pointer" : "default";
	}*/
}




